/**
 * 
 */
package chml;

import java.util.Comparator;

/**
 * @author chengmenglong
 * @param <T>
 *
 */
public class ComparatorWordCount implements Comparator<WordCount>{

	public int compare(WordCount arg1, WordCount arg2){
		WordCount w1 = (WordCount)arg1;
		WordCount w2 = (WordCount)arg2;
		int flag = w1.getCount() - w2.getCount();
		if(flag == 0){
			return w1.getWord().compareTo(w2.getWord());
		}
		return flag;
	}
}
